window.focus();
function OpenSite(url) {
  if (window.opener)
     window.opener.focus();
  else
     self.location = url;
}

function OpenImg(url, w, h) { 
  newwin = window.open(url, "image", "resizable=yes,scrollbars=yes,width="+w+",height="+h);
  newwin.focus();
}
$(document).ready(function(){
  // On cache les sous-menus :
  $('div.texte div.chapcont').hide();
  $('div.chapcont div.schapcont').hide();
  // Curseur main sur les h2.click, h3 et h4
  $('div.texte > h2.click').css('cursor','pointer');
  $('div.texte > h3').css('cursor','pointer');
  $('div.chapcont > h4').css('cursor','pointer');

  // handler du click sur h2.click (pour pref)
  $('div.texte > h2.click').click(function(){
    if ($(this).next('div.chapcont:visible').length!=0)
      {
	// changement du v en >
	$(this).children('img.plus').attr('src', '../../img/right.png');
	// si c'est ouvert on referme
	$(this).next('div.chapcont').slideUp('normal');
      }
    else
      {
	// si c'est ferme, on affiche
	$(this).next('div.chapcont').slideDown('normal');
        // changement du > en v
	$(this).children('img.plus').attr('src', '../../img/down.png');
      }
    return false;
  }); 
    
  // handler du click sur h3
  $('div.texte > h3').click(function(){
    if ($(this).next('div.chapcont:visible').length!=0)
      {
	// changement du v en >
	$(this).children('img.plus').attr('src', '../../img/right.png');

	// on ferme les sous-chapitres
	$(this).next('div.chapcont').find('div.schapcont').hide();

	// on met les v des sous-chapitres en >
	$(this).next('div.chapcont').find('h4').children('img.plus').attr('src', '../../img/right.png');

	// si c'est ouvert on referme
	$(this).next('div.chapcont').slideUp('normal');
      }
    else
      {
	// si c'est ferme, on affiche
	$(this).next('div.chapcont').slideDown('normal');

	// changement du > en v
	$(this).children('img.plus').attr('src', '../../img/down.png');
      }
    return false;
  }); 
    
  // handler du click sur h4
  $('div.chapcont > h4').click(function(){
    if ($(this).next('div.schapcont:visible').length!=0)
      {
	// changement du v en >
	$(this).children('img.plus').attr('src', '../../img/right.png');
	// si c'est ouvert on referme
	$(this).next('div.schapcont').slideUp('normal');
      }
    else
      {
	// si c'est ferme, on affiche
	$(this).next('div.schapcont').slideDown('normal');
	// changement du > en v
	$(this).children('img.plus').attr('src', '../../img/down.png');
      }
    return false;
  });

  // handler du click sur le bouton unfold
  $('div.unfold > input').click(function(){ 
    $('div.texte div.chapcont').slideDown('normal');
    $('div.chapcont div.schapcont').slideDown('normal');
    $('div.unfold').hide();
    $('div.fold').show();
    $('img.plus').attr('src', '../../img/down.png');
    return false;
  });

 // handler du click sur le bouton fold
  $('div.fold > input').click(function(){ 
    $('div.texte div.chapcont').hide();
    $('div.chapcont div.schapcont').hide();
    $('div.fold').hide();
    $('div.unfold').show();
    $('img.plus').attr('src', '../../img/right.png');
    return false;
  });

} ) ;

